package org.example.utils;

import cn.dev33.satoken.secure.SaSecureUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.model.chat.ChatResponse;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Value;

/**
 * @Author sunyaoyao
 * @Date 2024/7/30 20:15
 */

public class Test {
    public static void main(String[] args) throws Exception {
        Qianfan qianfan = new Qianfan("08fe22386e784b57943ce1f61df76ed6" , "2fbaf2e167c6495ca5b47cf2fb9b25eb" );
        //指定模型
        Gson gson = new Gson();
        qianfan.chatCompletion()
                .model("ERNIE-4.0-8K")
                .addMessage("user", "长治市2024年经济报告")
                // 启用流式返回
                .executeStream()
                .forEachRemaining(chunk -> System.out.print(gson.toJson(chunk)));


    }
}
